use std::{env,process};

use minigrep::Config;

fn main() {
    let args:Vec<String> = env::args().collect();//获取命令行参数
    //dbg!(args);
    /*[src/main.rs:4:5] args = [
        "target\\debug\\minigrep.exe",
        "nii",
        "nn",
    ]*/
    let config = Config::build(&args).unwrap_or_else(|err|{
        eprintln!("解析args错误:{}",err);//stderr
        process::exit(1);
    });//如果发射错误，执行下面
    if let Err(e) = minigrep::run(config) {
        println!("app err:{}",e);
        process::exit(1);
    };
    
}
